package Test.MyConfig;

import Test.Bean.MyServerCusConfigBean;
import Test.Bean.MySqlCusConfigBean;
import Test.Bean.ThirdBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

// proxyBeanMethods是否单例 value指定组件名字，默认为myConfig
@Configuration(proxyBeanMethods = true, value = "myConfig")
// 多用于加载第三方匹配值到容器中，需要标注@ConfigurationProperties(prefix)
@EnableConfigurationProperties({ThirdBean.class})
public class MyConfig {

    // 将组件添加到容器中
    @Bean(value = "mySqlCusConfig")
    MySqlCusConfigBean getMySqlCusConfig(){
        return new MySqlCusConfigBean();
    }

    @Bean(value = "myServerCusConfig")
    MyServerCusConfigBean getMyServerCusConfig(){
        return new MyServerCusConfigBean();
    }
}
